<!--
  @author: crissy-月下闲人
-->

<script lang="ts" setup>
import Card from '@/components/Card.vue'
import Swiper from '@/components/Swiper.vue'
import Floating from '@/components/Floating.vue'
const { safeAreaInsets } = uni.getSystemInfoSync()

const itemList: Array<any> = [
  {
    title: '陪诊服务',
    icon: '/static/svg/escort-service.png',
  },
  {
    title: '医院代办',
    icon: '/static/svg/agent.png',
  },
  {
    title: '定制服务',
    icon: '/static/svg/physical-examination.png',
  },
  {
    title: 'HPV疫苗',
    icon: '/static/svg/vaccine-services.png',
  },
]
</script>

<template>
  <view class="page">
    <Floating class="floating"></Floating>
    <view :style="{ paddingTop: safeAreaInsets?.top + 'px' }" class="page-header">
      <view class="header-content">
        <Swiper class="swiper"></Swiper>
      </view>
    </view>
    <view class="page-content">
      <view class="content-box">
        <view class="order-info">
          <view v-for="item in itemList" class="order-item">
            <image :src="item.icon" class="order-item-count" />
            <text class="order-item-title">{{ item.title }}</text>
          </view>
        </view>
      </view>
      <view class="card-list">
        <view class="card-list-title-box">
          <text class="card-list-title">热门陪诊师</text>
          <view class="svg-box">
            <image class="refresh-icon" src="/static/svg/refresh.png"></image>
            <text>换一组</text>
          </view>
        </view>
        <Card></Card>
      </view>
    </view>
  </view>
</template>

<style lang="scss" scoped>
$page-header-height: 450rpx;
$page-color: #ccc;
$page-content-color: #f2f8f7;
$svg-size: 70rpx;

$bg-1: linear-gradient(-45deg, #f7f1ff 0%, #e7ffec 20%, #d1f9e7 39%, #bcd2e7 76%, #b8d0e5 100%);

.page {
  width: 100%;
  height: 100vh;
  background: $bg-1;
}
.floating {
  width: 100px;
  height: 100px;
}
.page-header {
  height: $page-header-height;

  .header-content {
    width: 100%;
    height: $page-header-height;
  }
  .swiper {
    height: 150px;
    margin: 0 20px;
    border-radius: 15px;
  }
}

.page-content {
  height: calc(100vh - $page-header-height);
  background-color: $page-content-color;
  border-top-right-radius: 50rpx;
  border-top-left-radius: 50rpx;
  z-index: 9;
  padding: 55rpx 30rpx;

  .content-box {
    width: 100%;
    height: 400rpx;
    border-radius: 20rpx;
    margin-bottom: 20rpx;
  }

  .card-list {
    width: 100%;
    overflow-y: auto;

    .card-list-title-box {
      width: 100%;
      height: 100rpx;
      display: flex;
      align-items: center;
      position: relative;

      .card-list-title {
        font-size: 35rpx;
      }

      .svg-box {
        position: absolute;
        right: 0;
        display: flex;
        align-items: center;
        .refresh-icon {
          width: 40rpx;
          height: 40rpx;
        }
      }
    }
  }
}

.order-info {
  display: flex;
  width: 100%;
  height: 50%;
  align-items: center;
  justify-content: space-around;

  .order-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;

    .order-item-count {
      width: $svg-size;
      height: $svg-size;
    }

    .order-item-title {
      width: 100%;
      font-size: 34rpx;
      color: #474787;
    }
  }
}
</style>
